import {defaultSettings} from "@/settings"
import variables from '@/style/element-variables.scss'
import Cookies from "js-cookie"

const { showSettings,tagsView, fixedHeader, sidebarLogo,background } = defaultSettings
const state={
     theme: variables.theme,
    showSettings:showSettings,
    tagsView:tagsView,
    fixedHeader:fixedHeader,
    sidebarLogo:sidebarLogo,
    background:background
}
const mutations={
    CHANGE_SETTINGS: (state, { key, value }) => {
        if (state.hasOwnProperty.call(state,key)) {
          state[key] = value
          Cookies.set(key, value )
         
          console.log(variables.theme,key ,value)
        }
      }
}
const actions={
   changsSettings({commit},data){
    commit ("CHANGE_SETTINGS",data)
   }
}

export default{
    namespaced: true,
    state,
    mutations,
    actions
}